<?php

/**
* SPECIAL OFFERS
* Copyright (c) 2012 
* Author: Dmitriy Tovkach (ragvalod@gmail.com)
* @license		GNU/GPL
**/

// No direct access
defined('_JEXEC') or die;

jimport('joomla.application.component.view');


class SpecialViewSpecial extends JView
{
	protected $items;
	protected $pagination;
	protected $state;

	/**
	 * Display the view
	 */
	public function display($tpl = null)
	{
		$this->state		= $this->get('State');
		$this->items		= $this->get('Items');
		$this->pagination	= $this->get('Pagination');

		// Check for errors.
		if (count($errors = $this->get('Errors'))) {
			JError::raiseError(500, implode("\n", $errors));
			return false;
		}

		$this->addToolbar();
		parent::display($tpl);
	}

	protected function addToolbar()
	{
		require_once JPATH_COMPONENT.'/helpers/special.php';

		$state	= $this->get('State');
		//$canDo	= LocationsHelper::getActions($state->get('filter.category_id'));
		$user	= JFactory::getUser();

		JToolBarHelper::title(JText::_('COM_SPECIAL'), 'none.png');
		
			JToolBarHelper::addNew('promotion.add');
			JToolBarHelper::editList('promotion.edit');
			JToolBarHelper::divider();
			JToolBarHelper::publish('special.publish', 'JTOOLBAR_PUBLISH', true);
			JToolBarHelper::unpublish('special.unpublish', 'JTOOLBAR_UNPUBLISH', true);
			JToolBarHelper::divider();
			JToolBarHelper::deleteList('', 'special.delete', 'JTOOLBAR_EMPTY_TRASH');
			JToolBarHelper::divider();
			JToolBarHelper::trash('special.trash');
			JToolBarHelper::divider();
			JToolBarHelper::divider();
		
	}
}
